
var app = getApp();
var config = require('../../../../config.js');
const http = require('../../../../http.js')
var fromType = -1;
Page({

  /**
   * 页面的初始数据
   */
  /**
   * 页面的初始数据
   */
  data: {
    content:'',
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function(options) {
    fromType = options.type;
    if(fromType==1){
      this.getProtocols();//用户
    }else{
      this.getProtocol();//隐私协议
    }
  },


  /**
   * 每次打开页面都会调用一次。
   */
  onShow: function () {
  },
  onUnload: function () {
  },
  
  getProtocols:function(){
    var that = this;
    http.request(
      config.userProtocol,
      'GET',null,
      function (res) {
        if(res.rows != null && res.rows !=""){
          that.setData({
            content: res.rows[0].content,
          })
        }
       
      },
      function (err) {
        wx.showToast({
          title: err,
          icon: 'none',
        })
      }, true
    )

  },


 
  getProtocol:function(){
    var that = this;
    http.request(
      config.protocol,
      'GET',null,
      function (res) {
        if(res.rows != null && res.rows !=""){
          that.setData({
            content: res.rows[0].content,
          })
        }
      },
      function (err) {
        wx.showToast({
          title: err,
          icon: 'none',
        })
      }, true
    )

  },


})